<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost/busca_precos"
                   user="root" password=""/>
<sql:query dataSource="${snapshot}" var="result">
    SELECT * FROM usuarios WHERE dsc_email=?
    <sql:param value="${param.login}"/>
</sql:query>
<c:if test="${result.rowCount>0}">
    {result.rowCount
    ID: <c:out value="${result.rows[0].cod_usuario}"/><br/>
    Login: <c:out value="${result.rows[0].dsc_email}"/><br/>
    Senha: <c:out value="${result.rows[0].dsc_senha}"/><br/>
    <c:if test="${result.rows[0].dsc_senha == param.password}">
        Bem-vindo!
        <c:set var="login" value="${result.rows[0].dsc_nome}"
               scope="session"/>
        <c:redirect url="paginaUsuarioLogado.jsp"/>
    </c:if>
</c:if>


